package com.sunday.boot3.user.center.controller.impl;

import com.sunday.boot3.user.center.controller.UserController;
import com.sunday.boot3.user.center.pojo.dto.user.*;
import com.sunday.boot3.user.center.service.UserService;
import com.sunday.common.core.remoting.base.page.PageResultDTO;
import com.sunday.common.core.remoting.base.response.Response;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;

/**
 * @Description: 用户表 Controller 层
 * @author: zsy
 * @Create: 2024/09/22 16:24:39
 */
@Slf4j
@Controller
@RequiredArgsConstructor
public class UserControllerImpl implements UserController {

    private final UserService userService;

    /**
     * 获取登录用户信息
     * @param
     * @return {@link Response< GetLoginUserResDTO>}
     */
    @Override
    public Response<GetLoginUserResDTO> getLoginUser() {
        return Response.ok(userService.getLoginUser());
    }

    /**
     * 获取授权用户信息
     *
     * @param getAuthUserReqDTO
     * @return {@link Response< GetAuthUserResDTO>}
     */
    @Override
    public Response<GetAuthUserResDTO> getAuthUser(GetAuthUserReqDTO getAuthUserReqDTO) {
        return Response.ok(userService.getAuthUser(getAuthUserReqDTO));
    }

    /**
     * @Description: 新增 用户表 数据
     * @Param: [saveUserReqDTO]
     * @Return: com.sunday.common.core.remoting.base.response.Response
     * @Author: zsy
     * @Time: 2024/09/22 16:24:39
     */
    @Override
    public Response save(SaveUserReqDTO saveUserReqDTO) {
        userService.save(saveUserReqDTO);
        return Response.ok();
    }

    /**
     * @Description: 删除 用户表 数据
     * @Param: [removeUserReqDTO]
     * @Return: com.sunday.common.core.remoting.base.response.Response
     * @Author: zsy
     * @Time: 2024/09/22 16:24:39
     */
    @Override
    public Response remove(RemoveUserReqDTO removeUserReqDTO) {
        userService.remove(removeUserReqDTO);
        return Response.ok();
    }

    /**
     * @Description: 修改 用户表 数据
     * @Param: [updateUserReqDTO]
     * @Return: com.sunday.common.core.remoting.base.response.Response
     * @Author: zsy
     * @Time: 2024/09/22 16:24:39
     */
    @Override
    public Response update(UpdateUserReqDTO updateUserReqDTO) {
        userService.update(updateUserReqDTO);
        return Response.ok();
    }

    /**
     * @Description: 获取 用户表 分页列表数据
     * @Param: [pageUserReqDTO]
     * @Return: com.sunday.common.core.remoting.base.response.Response<com.sunday.common.core.remoting.base.page.PageResultDTO < com.sunday.boot3.user.center.pojo.dto.user.PageUserResDTO>>
     * @Author: zsy
     * @Time: 2024/09/22 16:24:39
     */
    @Override
    public Response<PageResultDTO<PageUserResDTO>> page(PageUserReqDTO pageUserReqDTO) {
        return Response.ok(userService.page(pageUserReqDTO));
    }



}
